<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>基本资料</title>
    <link rel="stylesheet" href="__PEAR__/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <div class="layui-form-item">
                    <label class="layui-form-label">登录账号</label>
                    <label class="layui-form-label" style="text-align:left;">
                    	{$one['loginname']}
                    </label>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="username" name="username" value="{$one['username']}" lay-verify="title" autocomplete="off" placeholder="请输入用户名称" class="layui-input">
                    </div>
                </div>
                
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="text" id="mobile" name="mobile" value="{$one['mobile']}" lay-verify="title" autocomplete="off" placeholder="请输入手机号" class="layui-input">
                    </div>
                </div>
                
                <div class="layui-form-item">
                    <label class="layui-form-label">电话</label>
                    <div class="layui-input-block">
                        <input type="text" id="telephone" name="telephone" value="{$one['telephone']}" lay-verify="title" autocomplete="off" placeholder="请输入电话" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-block">
                        <input type="text" id="email" name="email" value="{$one['email']}" lay-verify="title" autocomplete="off" placeholder="请输入邮箱" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">QQ</label>
                    <div class="layui-input-block">
                        <input type="text" id="qq" name="qq" value="{$one['qq']}" lay-verify="title" autocomplete="off" placeholder="请输入邮箱" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">微信号</label>
                    <div class="layui-input-block">
                        <input type="text" id="wechat" name="wechat" value="{$one['wechat']}" lay-verify="title" autocomplete="off" placeholder="请输入微信号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系地址</label>
                    <div class="layui-input-block">
                        <input type="text" id="address" name="address" value="{$one['address']}" lay-verify="title" autocomplete="off" placeholder="请输入微信号" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="__STATIC__/lib/layui/layui.js"></script>
<script src="__PEAR__/component/pear/pear.js"></script>
<script>
layui.use(['form','jquery'],function(){
    let form = layui.form;
    let $ = layui.jquery;

    form.on('submit(user-save)', function(data){
       
       var username=$("#username").val();
	   var mobile=$("#mobile").val();
	   var telephone=$("#telephone").val();
	   var email=$("#email").val();
	   var qq=$("#qq").val();
	   var wechat=$("#wechat").val();
	   var address=$("#address").val();

	   if(username==''){
	     layer.msg('角色名称不能为空');
		 return false;
	   }
	   if(mobile==''){
	      layer.msg('手机号不能为空');
		 return false;
	   }
		  
	 //提交添加
	   $.ajax({
            type: "POST",
            cache: false,
            url: "{:U('Main/updatePersonal')}",
            dataType: "json",
			data:{"username":username,"mobile":mobile,"telephone":telephone,"email":email,"qq":qq,"wechat":wechat,"address":address},
            async: false,
            success: function(data) {
            	
               if(data.code=='-1'){
            	 parent.layer.msg('更新失败,请重试');
               }
               else if(data.code=='1'){
            	 parent.layer.closeAll();
            	 parent.layer.msg('更新成功');
               }
            }
        });
	 
        return false;
    });
})
</script>
<script>
</script>
</body>
</html>
